<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>企业微信管理后台</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../css/reset.css">
    <!-- 2020-02-10 Version1.0 -->
    <link rel="stylesheet" href="../js/layui/css/layui.css">
    <link rel="stylesheet" href="../js/bootstrap/css/bootstrap.min.css">
    <!-- 2020-02-10 Version1.0 -->
    <link rel="stylesheet" href="../css/main.css">
</head>

<body style="background-color: #e9eaeb;min-height: 100%;position: relative;">
    <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
    <div class="index_page">
        <header class="header">
            <div class="header_area">
                <img class="gmmc_logo" src="../images/gmmc-logo-white.png" alt="广汽三菱.png">
                <!-- 2020-02-10 Version1.0 -->
                <div class="operation">
                    <img class="avatar" src="../images/test.JPG" alt="">
                    <span class="login_user" title="刘毅华">刘毅华</span>
                    <span class="modify_psw" id="modify_psw">修改密码</span>
                    <span class="quit_login" id="quit_login">退出</span>
                </div>
                <!-- 2020-02-10 Version1.0 -->
            </div>
        </header>
        <div class="nav_wrapper">
            <div class="nav_area">
                <div class="nav_item normal">
                    <span class="active" data-url="cus-contact/cus-contact.html">客户联系</span>
                </div>
                <div class="nav_item normal">
                    <span data-url="data-statistics/data-statistics.html">数据统计</span>
                </div>
                <div class="nav_item normal">
                    <span data-url="enterprise-staffing/enterprise-staffing.html">企业人员配置</span>
                </div>
                <div class="nav_item super_admin">
                    <span data-url="super-manager/shop-summary.html">各店数据统计汇总</span>
                </div>
                <div class="nav_item super_admin">
                    <span data-url="super-manager/shop-manager.html">店铺管理</span>
                </div>
                <div class="nav_item super_admin">
                    <span data-url="super-manager/login-data.html">登陆日志</span>
                </div>
            </div>
        </div>
        <div class="iframe_container">
            <iframe id="iframe_url" class="iframe_wrapper" src="cus-contact/cus-contact.html" allowtransparency="true"
                frameborder="0" scrolling="no" onload="this.height=100"></iframe>
        </div>
    </div>
    <!-- 2020-02-10 Version1.0 -->
    <!-- 修改密码模态框 -->
    <div class="modal fade normal_modal" id="modify_psw_modal" tabindex="-1" role="dialog"
        aria-labelledby="modify_psw_modal_label">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <form class="layui-form">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="modify_psw_modal_label">修改密码</h4>
                    </div>
                    <div class="modal-body">

                        <div class="layui-form-item">
                            <label class="layui-form-label">原密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="old_psw" required lay-verify="required"
                                    placeholder="请输入原密码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">新密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="new_psw" required lay-verify="required"
                                    placeholder="请输入新密码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">确认密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="new_psw_sure" required lay-verify="required"
                                    placeholder="请确认新密码" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" lay-submit
                            lay-filter="modify_psw_submit">确定</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- 修改密码模态框 -->
    <!-- 2020-02-10 Version1.0 -->
    <script src="../js/jquery-3.3.1.min.js"></script>
    <!-- 2020-02-10 Version1.0 -->
    <script src="../js/bootstrap/js/bootstrap.min.js"></script>
    <script src="../js/layui/layui.js"></script>
    <!-- 2020-02-10 Version1.0 -->
    <script>

        $("#quit_login").click(function () {
            window.location.href = "../login.html"
        })
        // 2020-02-10 Version1.0
        $("#modify_psw").click(function () {
            $("#modify_psw_modal").modal('show')
        })
        layui.use('form', function () {
            var form = layui.form;
            layui.use('layer', function () {
                var layer = layui.layer;
                form.on('submit(modify_psw_submit)', function (data) {
                    let old_psw = data.field.old_psw // 旧密码
                    let new_psw = data.field.new_psw // 新密码
                    let new_psw_sure = data.field.new_psw_sure // 确认新密码
                    if (new_psw != new_psw_sure) {
                        layer.msg('新密码输入不一致，请确认无误后再次输入')
                        return false
                    }
                    console.log(data.field)
                    $("#modify_psw_modal").modal('hide')
                })
            })
        })
        // 2020-02-10 Version1.0
        function reinitIframe() {
            var iframe = document.getElementById("iframe_url");
            try {
                var bHeight = iframe.contentWindow.document.body.scrollHeight;
                var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
                var height = Math.max(bHeight, dHeight);
                iframe.height = height;
            } catch (ex) { }
        }
        window.setInterval("reinitIframe()", 1000);

        // nav点击
        $('.nav_area').on('click', '.nav_item', function () {
            let url = $(this).children('span').attr('data-url')
            $(this).children('span').addClass('active').parent().siblings().children('span').removeClass('active')
            $("#iframe_url").attr('src', url)
        })

        // 页面控制
        let role = ''
        if (role == 'superAdmin') {
            $(".super_admin").show()
            $(".normal").hide()
            let dataurl = $(".super_admin").eq(0).children().attr('data-url')
            $(".super_admin").eq(0).children().addClass('active').parent().siblings().removeClass('active')
            $("#iframe_url").attr('src', dataurl)
        } else {
            $(".super_admin").hide()
            $(".normal").show()
            let dataurl = $(".normal").eq(0).children().attr('data-url')
            $(".normal").eq(0).children().addClass('active').parent().siblings().removeClass('active')
            $("#iframe_url").attr('src', dataurl)
        }
    </script>
</body>

</html>